-- resonance
-- created by panyl
-- 斯巴达！（敌人越多属性越多）

return {
    apply = function(prop, baseValue)
        return baseValue;
    end,

    -- 每回合触发
    trigger = function(who, prop, base)

        -- 如果不是在地牢中
        if not DungeonM.isInDungeon() then
            return base;
        end

        local count = 0;

        for _, grid in pairs(DungeonM.getCurrentDungeon() or {}) do
            local monster = grid.monster;

            -- 如果还未翻开，或者不是怪物，或者已经死亡，或者是观众
            if  grid:isOpened() and grid:isMonster() and
                monster and not monster:isDead() and
                not monster:isAudience() then
                count = count + 1;
            end
        end

        local baseAttrib = base or who.dbase:query(prop[2], 0);

        return baseAttrib + count * prop[3];
    end,

    record = function(target, prop, path)
        return false;
    end
};
